<?php
//借助类型提示和访问控制可以更好的控制类的接口
//ShopProduct 类 负责管理产品数据
class ShopProduct{
	//public $numPages;
	//public $playLength;
	public $title  ;
	public $productMainName  ;
	public $productFirstName  ;
	protected $price  ;
	private $discount = 2;
	
	//function __construct($title,$firstName,$mainName,$price,$numPages=0,$playLength=0){
	function __construct($title,$firstName,$mainName,$price){
		$this->title = $title;
		$this->productFirstName = $firstName;
		$this->productMainName = $mainName;
		$this->price = $price;
		/*$this->numPages = $numPages;
		$this->playLength = $playLength;*/
	}

	/*function getNumberOfPages(){
		return $this->numPages;
	}

	function getPlayLength(){
		retrun $this->playLength;
	}*/

	function getProducer(){
		return "{$this->productFirstName}"." "."{$this->productMainName}";
	}

	function getSummaryLine(){
		$base = "{$this->title}({$this->productMainName}, ";
		$base .="{$this->productFirstName} )";
		return $base;
	}

	public function setDiscount(){
		return $this->discount;
	}

	public function getPrice(){
		return $this->price - $this->discount;
	}
}




